<?php
namespace Plugin\Attractions\AttractionManagement\Schema\Attraction_type;

use Plugin\Attractions\AttractionManagement\Model\Attraction_type\AttractionType;
use Hyperf\Swagger\Annotation\Property;
use Hyperf\Swagger\Annotation\Schema;

/**
 * 分类表
 */
#[Schema(title: 'AttractionTypeSchema')]
class AttractionTypeSchema implements \JsonSerializable
{
    #[Property(property: 'id', title: 'id', type: 'bigint')]
    public string $id;

    #[Property(property: 'type', title: '类型0:点位，1:信息', type: 'tinyint')]
    public string $type;

    #[Property(property: 'name', title: '分类名称', type: 'varchar')]
    public string $name;

    #[Property(property: 'description', title: '分类描述', type: 'varchar')]
    public string $description;

    #[Property(property: 'sort', title: '排序', type: 'int')]
    public string $sort;

    #[Property(property: 'parent_id', title: '父级分类Id', type: 'int')]
    public string $parent_id;

    #[Property(property: 'level', title: '分类层级', type: 'int')]
    public string $level;

    #[Property(property: 'created_at', title: 'created_at', type: 'datetime')]
    public string $created_at;

    #[Property(property: 'updated_at', title: 'updated_at', type: 'datetime')]
    public string $updated_at;




    public function __construct(AttractionType $model)
    {
       $this->id = $model->id;
       $this->type = $model->type;
       $this->name = $model->name;
       $this->description = $model->description;
       $this->sort = $model->sort;
       $this->parent_id = $model->parent_id;
       $this->level = $model->level;
       $this->created_at = $model->created_at;
       $this->updated_at = $model->updated_at;

    }

    public function jsonSerialize(): array
    {
        return ['id' => $this->id ,'type' => $this->type ,'name' => $this->name ,'description' => $this->description ,'sort' => $this->sort ,'parent_id' => $this->parent_id ,'level' => $this->level ,'created_at' => $this->created_at ,'updated_at' => $this->updated_at];
    }
}